package com.tongji.seller
{
	import com.tongji.seller.command.AddImagesCommand;
	import com.tongji.seller.command.AddRecentSceneCommand;
	import com.tongji.seller.command.AddStoreItemCommand;
	import com.tongji.seller.command.AddStoreSceneCommand;
	import com.tongji.seller.command.DelStoreSceneCommand;
	import com.tongji.seller.command.DeleteProductCommand;
	import com.tongji.seller.command.GetSavedProductCommand;
	import com.tongji.seller.command.GetStoreFavoriteStateCommand;
	import com.tongji.seller.command.GetStoreItemInfoCommand;
	import com.tongji.seller.command.GetStoreItemsCommand;
	import com.tongji.seller.command.GetStoreRecentOperateSceneStateCommand;
	import com.tongji.seller.command.GetStoreSavedSystemSceneCommand;
	import com.tongji.seller.command.GetStoreSceneDetailCommand;
	import com.tongji.seller.command.GetStoreSystemSceneHotStateCommand;
	import com.tongji.seller.command.GetStoreSystemSceneStateCommand;
	import com.tongji.seller.command.GetStoreUserSceneCmd;
	import com.tongji.seller.command.GetTopHotSceneCommand;
	import com.tongji.seller.command.TypeCommand;
	import com.tongji.seller.command.UpdateImageCommand;
	import com.tongji.seller.events.AddImageEvent;
	import com.tongji.seller.events.AddRecentSceneEvent;
	import com.tongji.seller.events.AddStoreItemEvent;
	import com.tongji.seller.events.AddStoreSceneEvent;
	import com.tongji.seller.events.DelStoreSceneEvent;
	import com.tongji.seller.events.DeleteProductEvent;
	import com.tongji.seller.events.GetSavedProductEvent;
	import com.tongji.seller.events.GetStoreFavoriteStateEvent;
	import com.tongji.seller.events.GetStoreItemInfoEvent;
	import com.tongji.seller.events.GetStoreItemsEvent;
	import com.tongji.seller.events.GetStoreRecentOperateSceneStateEvent;
	import com.tongji.seller.events.GetStoreSavedSceneEvent;
	import com.tongji.seller.events.GetStoreSceneDetailEvent;
	import com.tongji.seller.events.GetStoreSystemSceneHotStateEvent;
	import com.tongji.seller.events.GetStoreSystemSceneStateEvent;
	import com.tongji.seller.events.GetStoreUserSceneEvent;
	import com.tongji.seller.events.GetTopHotSceneEvent;
	import com.tongji.seller.events.GetTypesEvent;
	import com.tongji.seller.events.UpdateItemImageEvent;
	import com.tongji.seller.model.FurnitureModel;
	import com.tongji.seller.model.GetSystemSceneModel;
	import com.tongji.seller.model.SearchSceneModel;
	import com.tongji.seller.model.StoreProductModel;
	import com.tongji.seller.model.StoreSceneModel;
	import com.tongji.seller.model.TypeModel;
	import com.tongji.seller.model.UserModel;
	import com.tongji.seller.model.UserSceneModel;
	import com.tongji.seller.service.AddStoreSceneService;
	import com.tongji.seller.service.DelStoreSceneService;
	import com.tongji.seller.service.StoreProductService;
	import com.tongji.seller.service.StoreSceneService;
	import com.tongji.seller.service.TypeService;
	import com.tongji.seller.service.UserSceneService;
	import com.tongji.seller.view.FirstStepView;
	import com.tongji.seller.view.FirstStepViewMediator;
	import com.tongji.seller.view.HomeView;
	import com.tongji.seller.view.HomeViewMediator;
	import com.tongji.seller.view.MainComp;
	import com.tongji.seller.view.MainCompMediator;
	import com.tongji.seller.view.SecondStepView;
	import com.tongji.seller.view.SecondStepViewMediator;
	import com.tongji.seller.view.ThirdStepView;
	import com.tongji.seller.view.ThirdStepViewMediator;
	import com.tongji.seller.view.Work;
	import com.tongji.seller.view.WorkMediatore;
	import com.tongji.seller.view.comp.CustomShowComp;
	import com.tongji.seller.view.comp.CustomShowCompMediatore;
	import com.tongji.seller.view.comp.EditSceneComp;
	import com.tongji.seller.view.comp.EditSceneCompMediator;
	import com.tongji.seller.view.comp.SceneView;
	import com.tongji.seller.view.comp.SceneViewMediator;
	import com.tongji.seller.view.comp.WorkComp;
	import com.tongji.seller.view.comp.WorkCompMediator;
	import com.tongji.seller.view.popup.AddImageTitleWindow;
	import com.tongji.seller.view.popup.AddImageTitlwWinMediator;
	import com.tongji.seller.view.popup.BrightTitleWinMediator;
	import com.tongji.seller.view.popup.BrightTitleWindow;
	import com.tongji.seller.view.popup.ChangeFurnitureTitleWinMediator;
	import com.tongji.seller.view.popup.ChangeFurnitureTitleWindow;
	import com.tongji.seller.view.popup.FilterTitleWinMediator;
	import com.tongji.seller.view.popup.FilterTitleWindow;
	import com.tongji.seller.view.popup.SaveLoadingTitleMediatore;
	import com.tongji.seller.view.popup.SaveLoadingTitleWindow;
	import com.tongji.seller.view.popup.SavedSceneTitleWinMediator;
	import com.tongji.seller.view.popup.SavedSceneTitleWindow;
	import com.tongji.seller.view.renderer.EditProductItemRenderer;
	import com.tongji.seller.view.renderer.EditProductItemRendererMediator;
	
	import flash.display.DisplayObjectContainer;
	
	import org.robotlegs.base.ViewMap;
	import org.robotlegs.mvcs.Context;
	
	/**
	 * 
	 * @author chenzhongyuan
	 * 2011-11-22
	 */
	
	public class StoreContext extends Context
	{
		public function StoreContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true)
		{
			super(contextView, autoStartup);
		}
		
		override public function startup():void
		{
			//Model
			injector.mapSingleton(FurnitureModel);
			injector.mapSingleton(GetSystemSceneModel);
			injector.mapSingleton(TypeModel);
			injector.mapSingleton(SearchSceneModel);
			injector.mapSingleton(StoreSceneModel);
			injector.mapSingleton(StoreProductModel);
			injector.mapSingleton(UserModel);
			injector.mapSingleton(UserSceneModel);


			//Service

			injector.mapSingleton(TypeService);

			injector.mapSingleton(StoreSceneService);
			injector.mapSingleton(StoreProductService);
			injector.mapSingleton(AddStoreSceneService);
			injector.mapSingleton(UserSceneService);
			injector.mapSingleton(DelStoreSceneService);


			
			//mapView
			mediatorMap.mapView(FirstStepView, FirstStepViewMediator);
			mediatorMap.mapView(SecondStepView, SecondStepViewMediator);
			mediatorMap.mapView(ThirdStepView, ThirdStepViewMediator);

			mediatorMap.mapView(MainComp, MainCompMediator);
			mediatorMap.mapView(SceneView, SceneViewMediator);
			mediatorMap.mapView(HomeView, HomeViewMediator);
			mediatorMap.mapView(CustomShowComp, CustomShowCompMediatore);
			
			mediatorMap.mapView(AddImageTitleWindow, AddImageTitlwWinMediator, null, false, false);
			mediatorMap.mapView(SavedSceneTitleWindow, SavedSceneTitleWinMediator, null, false, false);
			mediatorMap.mapView(ChangeFurnitureTitleWindow, ChangeFurnitureTitleWinMediator, null, false, false);
			mediatorMap.mapView(FilterTitleWindow, FilterTitleWinMediator, null, false, false);
			mediatorMap.mapView(BrightTitleWindow, BrightTitleWinMediator, null, false, false);
			mediatorMap.mapView(SaveLoadingTitleWindow, SaveLoadingTitleMediatore, null, false, false);


			mediatorMap.mapView(WorkComp, WorkCompMediator, null, false, true);
			mediatorMap.mapView(Work, WorkMediatore);
			mediatorMap.mapView(EditSceneComp, EditSceneCompMediator, null, false, true);
			mediatorMap.mapView(EditProductItemRenderer, EditProductItemRendererMediator);

			
			//mapEvent
			commandMap.mapEvent(GetTopHotSceneEvent.GET_STORE_HOT_SCENE, GetTopHotSceneCommand);
			commandMap.mapEvent(GetTopHotSceneEvent.UPDATE_HOT_SCENE, GetTopHotSceneCommand);
			

			commandMap.mapEvent(GetTypesEvent.GET_PLACES, TypeCommand);
			commandMap.mapEvent(GetTypesEvent.UPADATE_PLACES, TypeCommand);
			commandMap.mapEvent(GetTypesEvent.GET_STYLES, TypeCommand);
			commandMap.mapEvent(GetTypesEvent.UPDATE_STYLES, TypeCommand);


			
			commandMap.mapEvent(GetStoreSavedSceneEvent.GET_SAVED_SCENE, GetStoreSavedSystemSceneCommand);
			commandMap.mapEvent(GetStoreSavedSceneEvent.UPDATE_SAVED_SCENE, GetStoreSavedSystemSceneCommand);


			commandMap.mapEvent(GetStoreUserSceneEvent.GET_STORE_USER_SCENE, GetStoreUserSceneCmd);
			commandMap.mapEvent(GetStoreUserSceneEvent.UPDATE_STORE_USER_SCENE, GetStoreUserSceneCmd);




			commandMap.mapEvent(GetStoreItemsEvent.GET_ALL_ITEMS, GetStoreItemsCommand);
			commandMap.mapEvent(GetStoreItemsEvent.UPDATE_ALL_ITEMS, GetStoreItemsCommand);
			commandMap.mapEvent(GetStoreItemInfoEvent.GET_STORE_ITEM, GetStoreItemInfoCommand);
			commandMap.mapEvent(GetStoreItemInfoEvent.UPDATE_STORE_ITEM, GetStoreItemInfoCommand);
			commandMap.mapEvent(GetStoreItemInfoEvent.GET_STORE_PRODUCT, GetStoreItemInfoCommand);
			commandMap.mapEvent(GetStoreItemInfoEvent.UPDATE_STORE_PRODUCT, GetStoreItemInfoCommand);
			commandMap.mapEvent(AddStoreSceneEvent.ADD_STORE_FAVORITE_SCENE, AddStoreSceneCommand);
			commandMap.mapEvent(AddStoreSceneEvent.ADD_STORE_USER_SCENE, AddStoreSceneCommand);
			commandMap.mapEvent(AddStoreSceneEvent.ADD_STORE_USER_SYSTEM_SCENE, AddStoreSceneCommand);
			commandMap.mapEvent(GetStoreFavoriteStateEvent.GET_STORE_FAVORITE_STATE, GetStoreFavoriteStateCommand);
			commandMap.mapEvent(GetStoreFavoriteStateEvent.UPDATE_STORE_FAVORITE_STATE, GetStoreFavoriteStateCommand);
			commandMap.mapEvent(GetStoreSystemSceneStateEvent.GET_STORE_SYSTEM_SCENE_STATE, GetStoreSystemSceneStateCommand);
			commandMap.mapEvent(GetStoreSystemSceneStateEvent.UPDATE_STORE_SYSTEM_SCENE_STATE, GetStoreSystemSceneStateCommand);
			commandMap.mapEvent(GetStoreRecentOperateSceneStateEvent.GET_STORE_RECENT_OPERATE_SCENE_STATE, GetStoreRecentOperateSceneStateCommand);
			commandMap.mapEvent(GetStoreRecentOperateSceneStateEvent.UPDATE_STORE_RECENT_OPERATE_SCENE_STATE, GetStoreRecentOperateSceneStateCommand);
			commandMap.mapEvent(GetStoreSystemSceneHotStateEvent.GET_STORE_SYSTEM_SCENE_HOT_STATE, GetStoreSystemSceneHotStateCommand);
			commandMap.mapEvent(GetStoreSystemSceneHotStateEvent.UPDATE_STORE_SYSTEM_SCENE_HOT_STATE, GetStoreSystemSceneHotStateCommand, GetStoreSystemSceneHotStateEvent);
			
			
			commandMap.mapEvent(AddImageEvent.ADD_IMAGES, AddImagesCommand);
			commandMap.mapEvent(AddImageEvent.UPDATE_IMAGE, AddImagesCommand);
			commandMap.mapEvent(AddImageEvent.ADD_PNG_IMG, AddImagesCommand);
			commandMap.mapEvent(AddImageEvent.UPDATE_PNG_IMG, AddImagesCommand);
			
			commandMap.mapEvent(AddStoreItemEvent.ADD_STORE_ITEM, AddStoreItemCommand);
			commandMap.mapEvent(AddStoreItemEvent.ADD_STORE_ITEM_INFO_LIST, AddStoreItemCommand);
			commandMap.mapEvent(AddStoreItemEvent.GET_ITEMID, AddStoreItemCommand);
			
			commandMap.mapEvent(DelStoreSceneEvent.DEL_STORE_FAVORITE, DelStoreSceneCommand);
			commandMap.mapEvent(DelStoreSceneEvent.DEL_STORE_SYSTEM_SCENE, DelStoreSceneCommand);
			commandMap.mapEvent(DelStoreSceneEvent.DEL_STORE_USER_SCENE, DelStoreSceneCommand);
			commandMap.mapEvent(DelStoreSceneEvent.DEL_STORE_ITEM, DelStoreSceneCommand);

			commandMap.mapEvent(GetSavedProductEvent.GET_SAVED_PRODUCT, GetSavedProductCommand);
			commandMap.mapEvent(GetSavedProductEvent.UPDATE_SAVED_PRODUCT, GetSavedProductCommand);

			commandMap.mapEvent(GetStoreSceneDetailEvent.GET_SCENE_DETAIL, GetStoreSceneDetailCommand);
			commandMap.mapEvent(GetStoreSceneDetailEvent.UPDATE_SCENE_DETAIL, GetStoreSceneDetailCommand);
			
			commandMap.mapEvent(AddRecentSceneEvent.ADD_RECENT_SCENE, AddRecentSceneCommand);
			commandMap.mapEvent(DeleteProductEvent.DELETE_PRODUCT, DeleteProductCommand);
			commandMap.mapEvent(UpdateItemImageEvent.UPDATE_IMAGE, UpdateImageCommand);

		}
	}
}